#!/bin/sh
ovs-ofctl del-flows br-tun
ovs-ofctl add-flow br-tun "in_port=2,priority=1,actions=resubmit(,12)"
ovs-ofctl add-flow br-tun "in_port=1,actions=resubmit(,4)"
ovs-ofctl add-flow br-tun "table=4,priority=1,dl_vlan=100,actions=mod_vlan_vid:10,resubmit(,10)"
ovs-ofctl add-flow br-tun "table=4,priority=1,dl_vlan=200,actions=mod_vlan_vid:20,resubmit(,10)"
ovs-ofctl add-flow br-tun "table=10,priority=1,actions=learn(table=20,hard_timeout=300,priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:0->NXM_OF_VLAN_TCI[],load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],output:NXM_OF_IN_PORT[]),output:2"
ovs-ofctl add-flow br-tun "table=12,priority=1,dl_vlan=10,actions=mod_vlan_vid:100,resubmit(,2)"
ovs-ofctl add-flow br-tun "table=12,priority=1,dl_vlan=20,actions=mod_vlan_vid:200,resubmit(,2)"
ovs-ofctl add-flow br-tun "table=2,priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,20)"
ovs-ofctl add-flow br-tun "table=2,priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,20)"
ovs-ofctl add-flow br-tun "table=20,priority=0,actions=resubmit(,22)"
ovs-ofctl add-flow br-tun "table=22,actions=set_tunnel:0x64,output:1"
